package orchestration.android.execution.tasks;

import orchestration.android.RunExecutionActivity;
import orchestration.android.execution.exceptions.TaskExecutionException;
import orchestration.persistence.exceptions.UnsupportedTypeException;
import android.content.Intent;
import android.content.IntentFilter;

public class ReceiveBroadcastTask extends AndroidTask{

	private IntentFilter filter;
	
	public ReceiveBroadcastTask(String id) {
		super(id);
	}

	@Override
	public void onExecute(RunExecutionActivity atl) throws TaskExecutionException {
		Intent result= atl.registerReceiver(null, filter);
		try {
			saveTaskOutput(atl, result);
		} catch (UnsupportedTypeException e) {
			throw new TaskExecutionException(e);
		}
	}

}
